const MovieHttp = require("../../utils/MovieHttp")
const { handleStar } = require("../../utils/Star")
Page({
  data: {

  },
  onLoad: async function () {
    var res = await MovieHttp.getInTheaters()
    var Theaters = []
    console.log(res)
    var res = res.data.res
    res.forEach(item => {
      var { title, pic, raiting, _id } = item;
      var star = raiting
      Theaters.push({
        title,
        pic,
        raiting,
        _id,
        star: handleStar(star)
      })
    })
    this.setData({
      Theaters
    })
  },
  handleClick(event) {
    console.log(event.currentTarget.dataset)
    var { aid } = event.currentTarget.dataset
    wx.navigateTo({
      url:`/pages/detailsoon/detailsoon?id=${aid}`
    })
  }
})